<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAkbusPersonnelTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('akbus_personnel', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name')->comment('姓名');
            $table->string('native_place')->nullable()->comment('籍贯');

            $table->tinyInteger('status')->comment('人员状态');
            $table->tinyInteger('type')->comment('人员类型');
            $table->date('departure_at')->nullable()->comment('离职时间');
            $table->tinyInteger('is_injured')->nullable()->comment('是否工伤人员');


            $table->string('IDCard_url')->nullable()->comment('身份证图片地址');
            $table->string('ID_photo_url')->nullable()->comment('证件照');
            $table->string('IDCard')->nullable()->comment('身份证号');
            $table->date('IDCard_expire_at')->nullable()->comment('身份证到期时间');

            $table->string('phone')->nullable()->comment('联系电话');

            $table->string('IDCard_address')->nullable()->comment('身份证地址');
            $table->string('residential_address')->nullable()->comment('现居住地址');

            $table->string('nation')->nullable()->comment('民族');
            $table->string('political')->nullable()->comment('政治面貌');
            $table->string('married')->nullable()->comment('婚姻状况');
            $table->tinyInteger('education')->nullable()->comment('学历');
            $table->string('major')->nullable()->comment('专业');
            $table->string('graduated_school')->nullable()->comment('毕业院校');
            $table->date('graduated_at')->nullable()->comment('毕业时间');

            $table->date('work_at')->nullable()->comment('参加工作时间');
            $table->date('join_at')->nullable()->comment('入职时间');
            $table->date('positive_at')->nullable()->comment('转正时间');
            $table->date('contract_expire_at')->nullable()->comment('合同到期时间');

            $table->tinyInteger('endowment_insurance_status')->nullable()->comment('养老保险状态');
            $table->date('endowment_insurance_payment_at')->nullable()->comment('养老入保时间');
            $table->tinyInteger('medical_insurance_status')->nullable()->comment('医疗保险状态');
            $table->date('medical_insurance_payment_at')->nullable()->comment('医疗入保时间');
            $table->tinyInteger('unemployment_insurance_status')->nullable()->comment('失业保险状态');
            $table->date('unemployment_insurance_payment_at')->nullable()->comment('失业入保时间');
            $table->tinyInteger('injured_insurance_status')->nullable()->comment('工伤保险状态');
            $table->date('injured_insurance_payment_at')->nullable()->comment('工伤入保时间');
            $table->tinyInteger('maternity_insurance_status')->nullable()->comment('生育保险状态');
            $table->date('maternity_insurance_payment_at')->nullable()->comment('生育入保时间');
            $table->decimal('sort', 10, 2)->nullable()->comment('排序');

            $table->string('note')->nullable()->comment('备注');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('akbus_personnel');
    }
}
